<cfapplication name="cfhibernateexampleapp" sessionmanagement="yes" />

<cfparam name="url.reinit" default="0">
<cfscript>
	// initialize the application variables if necessary
	if ((Not StructKeyExists(Application, "inited") OR 
		Not Application.inited) OR 
		(StructKeyExists(url, "init") AND url.init)) {
		
		/* put ormService object in Application scope
			so we don't take this hit every time */

		application.ormService = createObject("component","ORMService").init(expandpath("./hibernate.cfg.xml"),"appexample");

		// set DSN
		Application.dsn = "cfhibernate";
		
			
		log4jconfig = createObject("java", "org.apache.log4j.PropertyConfigurator");
		log4jconfig.configure(expandpath("./log4j.properties"));
		
		// set inited flag
		Application.inited = true;
	}
	request.ormService = application.ormService;
</cfscript>
